home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / jaz_clib.arc / SOUNDON.ASM < prev    next >
Assembly Source File  |  1989-04-09  |  652b  |  32 lines

  1.  
  2.     assume cs:_text
  3. _text    segment public byte 'code'
  4.     public _soundon
  5.  
  6. _soundon  proc near
  7.     push bp
  8.     mov bp,sp
  9.     mov cx,[bp+4]        ; get frequency
  10.  
  11.     mov dx,12        ; upper part of numerator
  12.     mov ax,343eh        ; lower part of numerator
  13.     div cx            ; Divide specified frequency into
  14.                 ; 1,193,182 hz clock freq used by timer
  15.     mov cx,ax        ; result in ax
  16.  
  17.     mov al,cl        ; lower byte out to timer
  18.     out 42h,al
  19.     mov al,ch        ; high byte out to timer
  20.     out 42h,al
  21.  
  22.     in al,61h        ; get contents of system port b
  23.     or al,3         ; turn speaker and timer on
  24.     out 61h,al        ; send out new values to port b
  25.  
  26.     mov sp,bp
  27.     pop bp
  28.     ret
  29. _soundon  endp
  30. _text    ends
  31. end
  32.